package code;

public class ReplaceSpace {
    public String Solution(StringBuffer str) {
        char[] a = str.toString().toCharArray();
        String re = "";
        for (int i = 0; i < a.length; i++) {
            if (String.valueOf(a[i]).equals(" ")) {
                re = re + "%20";
            } else {
                re = re + String.valueOf(a[i]);
            }
        }
        return re;
    }

    public static void main(String[] argv){
        ReplaceSpace replaceSpace = new ReplaceSpace();
        StringBuffer s = new StringBuffer("asd asd   asd  dwe ");
        System.out.println(replaceSpace.Solution(s));

    }
}
